<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "{{%information}}".
 *
 * @property integer $id
 * @property integer $type
 * @property string $title
 * @property string $cover_img
 * @property string $content
 * @property string $commentcount
 * @property string $browsecount
 * @property integer $top
 * @property integer $status
 * @property string $created_at
 * @property string $updated_at
 */
class Information extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%information}}';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['type', 'title', 'content', 'created_at', 'updated_at'], 'required'],
            [['type', 'top', 'status', 'created_at', 'updated_at', 'commentcount', 'browsecount'], 'integer'],
            [['title','link'], 'string', 'max' => 255],
            [['cover_img'], 'string', 'max' => 100],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('app', 'ID'),
            'type' => Yii::t('app', '类型'),
            'title' => Yii::t('app', '标题'),
            'cover_img' => Yii::t('app', '封面图片'),
            'content' => Yii::t('app', '内容'),
            'commentcount' => Yii::t('app', '评论数'),
            'browsecount' => Yii::t('app', '浏览量'),
            'top' => Yii::t('app', '置顶'),
            'link' => Yii::t('app', '链接'),
            'status' => Yii::t('app', '状态 0关闭 1开启 '),
            'created_at' => Yii::t('app', '创建时间'),
            'updated_at' => Yii::t('app', '更新时间'),
        ];
    }

    /**
     * @inheritdoc
     * @return InformationQuery the active query used by this AR class.
     */
    public static function find()
    {
        return new InformationQuery(get_called_class());
    }
}
